Dough Git

clove/pkviewer

web/src/routes/s/[systemRef]/+page.svelte

back to web/src/routes/s/[systemRef]

<!-- web/src/routes/s/[systemRef]/+page.svelte -->
<script lang="ts">
  import { buildPageTheme } from "$lib/theme.ts";
  import BadgeRow from "$lib/components/BadgeRow.svelte";
  import CustomStyle from "$lib/components/CustomStyle.svelte";
  import Icon from "$lib/components/Icon.svelte";
  import MemberDirectory from "$lib/components/MemberDirectory.svelte";
  import Meta from "$lib/components/Meta.svelte";
  import SiteDisclosure from "$lib/components/SiteDisclosure.svelte";
  import SocialLinks from "$lib/components/SocialLinks.svelte";
  import StaleNotice from "$lib/components/StaleNotice.svelte";
  import ThemeFonts from "$lib/components/ThemeFonts.svelte";
  import TokenStyle from "$lib/components/TokenStyle.svelte";

  let { data } = $props();

  const system = $derived(data.page.system);
  const composition = $derived(data.page.composition);
  const name = $derived(system.name ?? system.hid);
  const theme = $derived(buildPageTheme(data.page.tokens, null, composition));
  const showBanner = $derived(composition["banner.display"] !== "hidden");
  const showPronouns = $derived(composition["show.pronouns"] !== "false");
</script>

<!-- Server-rendered so Discord's unfurler, which runs no JavaScript, gets a real card (A2) -->
<Meta
  title="{name} · pkviewer"
  description={system.description?.slice(0, 200) ?? `The ${name} system on pkviewer.`}
  path={data.page.canonicalPath}
  image={system.avatarUrl}
  type="profile"
/>

<main class="page stack" id="pkv-user">
  <ThemeFonts fonts={theme.fonts} />
  <TokenStyle
    vars={theme.vars}
    darkVars={theme.darkVars}
    colorScheme={theme.colorScheme}
    scope=":root"
  />

  <CustomStyle css={data.page.css} />

  {#if system.staleSinceMs !== null}
    <StaleNotice staleSinceMs={system.staleSinceMs} />
  {/if}

  {#if showBanner && system.bannerUrl}
    <img class="banner" src={system.bannerUrl} alt="" />
  {/if}

  <header class="identity">
    {#if system.avatarUrl}
      <img class="avatar" src={system.avatarUrl} alt="" />
    {:else}
      <Icon name="person-circle" class="avatar" />
    {/if}
    <div class="stack-tight" style="min-width: 0">
      <h1 style="margin: 0; overflow-wrap: anywhere">{name}</h1>
      <ul class="meta-list muted">
        <li><code>{system.hid}</code></li>
        {#if showPronouns && system.pronouns}
          <li>{system.pronouns}</li>
        {/if}
        {#if system.tag}
          <li>{system.tag}</li>
        {/if}
        <li>
          <Icon name="people-fill" /> {system.memberCount}
          {system.memberCount === 1 ? "member" : "members"}
        </li>
      </ul>
    </div>
  </header>

  <BadgeRow badges={data.page.badges} />

  {#if system.description}
    <section class="prose">
      <p style="white-space: pre-wrap">{system.description}</p>
    </section>
  {/if}

  <SocialLinks links={data.page.socials} />

  <section class="stack-tight">
    <h2>Members</h2>
    <MemberDirectory members={data.page.members} {composition} />
  </section>

  <SiteDisclosure />
</main>